const { defineConfig } = require('@vue/cli-service')
const AutoImport = require('unplugin-auto-import/webpack')
const Components = require('unplugin-vue-components/webpack')
const { ElementPlusResolver } = require('unplugin-vue-components/resolvers')

module.exports = defineConfig({
  // 如果模式是正式环境则添加上context-path
  publicPath: process.env.NODE_ENV === 'production' ? '/yoo-xx/' : '/',
  filenameHashing: true,
  transpileDependencies: true,
  parallel: true,
  // webpack的配置
  configureWebpack: config => {
    config.plugins.push(
      AutoImport({
        resolvers: [ElementPlusResolver()]
      })
    )
    config.plugins.push(Components({
      resolvers: [ElementPlusResolver()]
    }))
  }
})
